﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Utils.ContentManagement;

namespace Utils.Drawing
{
    public class AnimatedTexture
    {
        List<Texture2D> textures = new List<Texture2D>();

        public List<Texture2D> Textures { get { return textures; } }

        public  AnimatedTexture(string path, ContentLoader loader, int frames)
        {
            if(path[path.Length-1] != '/' || path[path.Length-1] != '\\')
            {
                path += "/";
            }

            for(int i=0; i<frames; i++)
            {
                string frameName;

                if(i<10) 
                {
                    frameName = "000"+i;
                }
                else if(i<100)
                {
                    frameName = "00"+i;
                }
                else if(i<1000)
                {
                    frameName = "0"+i;
                }
                else
                {
                    frameName = i.ToString();
                }

                textures.Add(loader.Load<Texture2D>(path + frameName));
            }
        }
    }
}
